<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script src="//cdn.bootcss.com/immutable/3.8.1/immutable.min.js"></script>
<script>
  console.log("原生对比");
  // 对比2个JSON
  var app1 = {
    name: "wei",
    age: 24
  };
  var app2 = {
    name: "yi",
    age: 23
  };
  var app3 = {
    name: "wei",
    age: 24
  };
  console.log(app1 == app2); // => false
  console.log(app1 == app1); // => true
  console.log(app1 == app3); // => false

  console.log("immutable对比");
  // 为什么app1和app3不同，因为他们指向的堆内存不同，无法对比
  // immutable对比方法
  var app1Imm = Immutable.Map(app1);
  var app2Imm = Immutable.Map(app2);
  var app3Imm = Immutable.Map(app3);
  console.log(Immutable.is(app1Imm,app2Imm));  // => false
  console.log(Immutable.is(app1Imm,app1Imm));  // => true
  console.log(Immutable.is(app1Imm,app3Imm));  // => true
</script>
</body>
</html>
